﻿Public Class GestorPersona
    Public Function getTipoDoc(ByVal IdTipoDoc As String) As CapaDeNegocio.TipoDocumento
        Dim objDataAccess As laboratorio_Datos.DataAccess = New laboratorio_Datos.DataAccess
        Dim objDataReader As OleDb.OleDbDataReader

        objDataReader = objDataAccess.getDataReader("SELECT * FROM LABT_TIPO_DOCUMENTO WHERE ID_TIPO_DOCUMENTO='" & IdTipoDoc.ToUpper & "'")

        If objDataReader.HasRows = True Then
            Dim objTipoDoc As CapaDeNegocio.TipoDocumento = New CapaDeNegocio.TipoDocumento
            objDataReader.Read()
            objTipoDoc.idTipoDoc = Trim(objDataReader.Item(0).ToString)
            objTipoDoc.descripcion = Trim(objDataReader.Item(1).ToString)
            objDataAccess.CloseConnection()
            Return objTipoDoc
        Else
            objDataAccess.CloseConnection()
            Return Nothing
        End If
    End Function

    Public Function validarTipoDoc(ByVal objTipoDoc As CapaDeNegocio.TipoDocumento) As Boolean
        Dim objDataAccess As laboratorio_Datos.DataAccess = New laboratorio_Datos.DataAccess
        Dim objDataReader As OleDb.OleDbDataReader

        objDataReader = objDataAccess.getDataReader("SELECT 1 FROM LABT_TIPO_DOCUMENTO WHERE id_tipo_documento='" & Trim(objTipoDoc.idTipoDoc & "'"))

        If objDataReader.HasRows Then
            Return True
        Else
            Return False
        End If

        objDataAccess.CloseConnection()
    End Function
End Class
